/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.utilities;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.text.SimpleDateFormat;
import java.util.Calendar;

/**
 *
 * @author David
 */
public class Logger {
    public static void log(String message) {
        //get the current and time
        String now = new SimpleDateFormat("yyyyMMdd_HHmmss").format(Calendar.getInstance().getTime());
        
        //open a file for writing
        try {            
            BufferedWriter bw = new BufferedWriter(new FileWriter("log.dat", true));
            bw.write("\n" + now + " - " + message);
            bw.close();
        } catch(Exception e) {
            e.printStackTrace();
        }
    }
    
    public static void main(String args[]) {
        Logger.log("test3");
    }
}
